#include "Event.h"

namespace Gw2API{

Event::Event(std::string *id, std::string *name, std::string *state)
{
	if(id != 0)
		event_id = *id;
	if(name != 0)
		event_name = *name;
	if(state == 0)
		this->state = undef;
	else
		updateState(state);
}


Event::~Event(void)
{
}


void Event::setState(enum state state){
	this->state = state;
}


bool Event::updateState(std::string *state){
	if(strcmp(state->c_str(), "Active") == 0)
		this->state = active;
	else if(strcmp(state->c_str(), "Preparation") == 0)
		this->state = preparation;
	else if(strcmp(state->c_str(), "Warmup") == 0)
		this->state = warmup;
	else if(strcmp(state->c_str(), "Fail") == 0)
		this->state = fail;
	else if(strcmp(state->c_str(), "Success") == 0)
		this->state = success;
	else{
		this->state = undef;
		return false;
	}
	return true;
}
};